



<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
    <title>用户列表</title>
    <!-- Bootstrap 5 CDN -->
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.11.1/font/bootstrap-icons.min.css">
    <script src="js/bootstrap.bundle.min.js"></script>
</head>
<body class="container mt-4">
<h2>用户列表</h2>

<table class="table table-bordered">
    <thead>
    <tr>
        <th>ID</th>
        <th>用户名</th>
        <th>电话</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${userList}" var="user">
        <tr>
            <td>${user.id}</td>
            <td>${user.username}</td>
            <td>${user.phone}</td>
            <td>
                <c:if test="${not empty article.createdAt}">
                    ${article.createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))}
                </c:if>
            </td>


            <td>
                <a class="btn btn-sm btn-warning"
                   href="userServlet?method=updateUser&id=${user.id}">编辑</a>
                <a class="btn btn-sm btn-danger"
                   href="javascript:if(confirm('确认删除？'))location='userServlet?method=deleteUser&id=${user.id}'">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>

<a class="btn btn-primary" href="userUpdate.jsp">新增用户</a>

</body>
</html>